<script setup lang="ts">
import docService from "../http/DocService";
import TheCommonTable from "../components/the-common-table.vue";

const columns = [
  {
    title: 'id',
    dataIndex: 'id',
    key: 'id'
  }, {
    title: '名称',
    dataIndex: 'name',
    key: 'name'
  }, {
    title: '书名',
    dataIndex: 'ebookName',
    key: 'ebookName'
  }, {
    title: '排序',
    dataIndex: 'sort',
    key: 'sort'
  }, {
    title: '阅读数',
    dataIndex: 'viewCount',
    key: 'viewCount'
  }, {
    title: '点赞数',
    dataIndex: 'voteCount',
    key: 'voteCount'
  }, {
    title: '操作',
    key: 'action'
  }
]

const editingForm: FormItem[] = [
  {
    label: '文档名',
    dataIndex: 'name',
    inputType: 'text'
  }, {
    label: '内容',
    dataIndex: 'content',
    inputType: 'text'
  }, {
    label: '父文档',
    dataIndex: 'parent.id',
    formIndex: 'parentId',
    inputType: 'text'
  }, {
    label: '所属电子书',
    dataIndex: 'ebook.id',
    formIndex: 'ebookId',
    inputType: 'text'
  }, {
    label: '阅读数',
    dataIndex: 'viewCount',
    inputType: 'text'
  }, {
    label: '点赞数',
    dataIndex: 'voteCount',
    inputType: 'text'
  }
]
</script>

<template>
  <the-common-table :service="docService"
                    editing-value-key-name="id"
                    :columns="columns"
                    :editing-form="editingForm">
  </the-common-table>
</template>

<style scoped>

</style>